package org.springblade.modules.repair.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.repair.dto.CheckPlanDeptCountDTO;
import org.springblade.modules.repair.dto.CheckPlanPageQueryDTO;
import org.springblade.modules.repair.dto.CheckPlanTrendQueryDTO;
import org.springblade.modules.repair.dto.PlanCheckStatisticsQueryDTO;
import org.springblade.modules.repair.entity.Elevator;
import org.springblade.modules.repair.entity.MaintainPlanUserDayCount;
import org.springblade.modules.repair.vo.CheckPlanUserCountVO;
import org.springblade.modules.repair.vo.PlanUserDayCountVO;
import org.springblade.modules.repair.vo.check.PlanCheckStatisticsBuildingPageVO;
import org.springblade.modules.repair.vo.check.PlanCheckStatisticsElevatorListVO;
import org.springblade.modules.repair.vo.statistics.by.CheckStatisticsWorkTimeDetailVO;

import java.util.Date;
import java.util.List;

public interface MaintainPlanUserDayCountMapper extends BaseMapper<MaintainPlanUserDayCount> {
    List<PlanUserDayCountVO> selectUserCheckPlanDayCount(@Param("queryDTO") CheckPlanPageQueryDTO queryDTO);

	List<PlanUserDayCountVO> selectCheckPlanTimeDayCount(@Param("queryDTO") CheckPlanTrendQueryDTO queryDTO);

	List<PlanUserDayCountVO> selectUserCheckPlanTimeDayCount(@Param("queryDTO") CheckPlanTrendQueryDTO queryDTO);

	List<PlanUserDayCountVO> selectUserCheckPlanTimeWeekCount(@Param("userIds")String userIds,@Param("startTime") Date startTime,@Param("endTime") Date endTime);

//	PlanUserDayCountVO selectUserOrDeptCheckPlanTimeDayCount(@Param("date") Date date,@Param("id") String id,@Param("type") Integer type);

	PlanUserDayCountVO selectUserOrDeptCheckPlanTimeWeekCount(@Param("startTime") Date startTime,@Param("endTime") Date endTime,@Param("id") String id,@Param("type") Integer type,@Param("useType") Integer useType);

	PlanUserDayCountVO selectUserOrDeptCheckPlanTimeMonthCount(@Param("date") Date date,@Param("id") String id,@Param("type") Integer type,@Param("useType") Integer useType);

    CheckPlanUserCountVO selectCheckPlanUserCount(@Param("userId") Long userId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("useType") Integer useType);

	CheckPlanUserCountVO selectCheckPlanUserSignCount(@Param("userId") Long userId, @Param("startTime") String startTime, @Param("endTime") String endTime,@Param("useType") Integer useType);

	CheckPlanUserCountVO selectCheckPlanUserDurationTimeliness(@Param("userId") Long userId,@Param("startTime") String startTime,@Param("endTime") String endTime, @Param("useType") Integer useType);

	CheckPlanUserCountVO selectCheckPlanDeptCount(@Param("userIds") List<Long> deptUserIds,@Param("queryDTO") CheckPlanDeptCountDTO queryDTO);

	CheckPlanUserCountVO selectCheckPlanDeptSignCount(@Param("userIds") List<Long> deptUserIds,@Param("queryDTO") CheckPlanDeptCountDTO queryDTO);

	CheckPlanUserCountVO selectCheckPlanDeptDurationTimeliness(@Param("userIds") List<Long> deptUserIds,@Param("queryDTO") CheckPlanDeptCountDTO queryDTO);

	List<PlanUserDayCountVO> selectUserOrDeptCheckPlanTimeDayCount(@Param("id") String id,@Param("queryDTO") CheckPlanTrendQueryDTO queryDTO);

	List<PlanUserDayCountVO> selectUserOrDeptCheckPlanTimeDayCount2(@Param("deptIds")List<Long> deptIds,@Param("queryDTO") CheckPlanTrendQueryDTO queryDTO);

	PlanUserDayCountVO selectUserOrDeptCheckPlanTimeWeekCount2(@Param("startTime") Date startTime,@Param("endTime") Date endTime,@Param("deptIds") List<Long> deptIds,@Param("type") Integer type,@Param("useType") Integer useType);

	PlanUserDayCountVO selectUserOrDeptCheckPlanTimeMonthCount2(@Param("date") Date date,@Param("deptIds") List<Long> deptIds, @Param("type") Integer type, @Param("useType") Integer useType);

	List<MaintainPlanUserDayCount> listAllByPlanner();

    CheckStatisticsWorkTimeDetailVO selectCheckWorkTimeDeptDetail(@Param("queryDTO") PlanCheckStatisticsQueryDTO queryDTO, @Param("userIds") List<Long> userIds);

    List<MaintainPlanUserDayCount> selectByUserDate(@Param("queryDTO") PlanCheckStatisticsQueryDTO queryDTO);

	List<MaintainPlanUserDayCount> selectPlanStatusByUserDate(@Param("queryDTO") PlanCheckStatisticsQueryDTO queryDTO);

	List<MaintainPlanUserDayCount> selectPlanTimelinessByUserDate(@Param("queryDTO") PlanCheckStatisticsQueryDTO queryDTO);

	List<MaintainPlanUserDayCount> selectPlanOverdueByUserDate(@Param("queryDTO")PlanCheckStatisticsQueryDTO queryDTO);

	CheckStatisticsWorkTimeDetailVO selectCheckWorkDurationDeptDetail(@Param("planIds") List<Long> planIds);

	List<Long> selectCheckPlanIds(PlanCheckStatisticsQueryDTO queryDTO, List<Long> userIds);

	List<MaintainPlanUserDayCount> selectByUserDateV2(List<Long> planIds);

    List<PlanCheckStatisticsBuildingPageVO> selectPlanCheckBuildingPage(IPage<PlanCheckStatisticsBuildingPageVO> page,@Param("buildingIds") List<Long> buildingIds);

	List<PlanCheckStatisticsElevatorListVO> selectPlanCheckElevatorList(@Param("elevatorIds") List<Long> elevatorIds);

	List<Elevator> selectPlanCheckBuildingElevatorIdsByDept();

	List<Elevator> selectPlanCheckBuildingElevatorIdsByUser();

	List<Elevator> selectPlanCheckBuildingElevatorIdsByNotPlan();

	List<Elevator> selectPlanCheckBuildingElevatorIdsByNotFeature(@Param("useType") Integer useType,@Param("maintainStatus") Integer maintainStatus);

	List<Elevator> selectPlanCheckBuildingElevatorIdsByCompliance(@Param("deptName") String deptName,@Param("compliance") Integer compliance);

	List<Elevator> selectPlanCheckBuildingElevatorIdsByHasFeature();

}
